package cn.edu.ctbu.datajpa.service;


import cn.edu.ctbu.datajpa.domain.Student;
import org.springframework.data.domain.Example;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public interface StudentService {

    List<Student> findAll();

    /**
     * 只分页的查询
     * @param pageable
     * @return
     */
    Page<Student> findAll(Pageable pageable);

    /**
     * 按id进行查询 @param id 主键，整数
     * @return
     */
    Student findById(Integer id);


    /**
     * 按名字进行查询 like * @param id 主键，整数
     * @return
     */
    List<Student> findByname(String name);

    Student getById(Integer id);

    Student insert(Student student);

    Student update(Student student);

    void delete(Student student);

    void delete(Integer id);

    Student findByName(String name);

    /**
     * 分页，带过滤的查询
     * @param student
     * @param pageable
     * @return
     */
    public Page<Student> findAll( Example<Student> student,Pageable pageable);

    /**
     * 按学号和密码登录
     * @param no
     * @param password
     * @return
     */
    public List<Student> findByNoAndPassword(String no,String password);   //学号，密码登录


}
